// t5Miali.txt
// Modified basicnpc.txt, used under the Hektos ruins. This creature does
//  not fight, and defaults to pose 14 every turn.
//
// Memory Cells:
//   Cell 0 - How creature moves.
//     0 - If 0, wander randomly. 
//     1 - Stands still until a target appears.
//     2 - Completely immobile, even if target appears.
//   Cell 1,2 - Stuff done flag. If both 0, nothing. Otherwise when this 
//     is killed, set to 1. (Example: If cell 1 is 3 and cell 2 is 5, when
//     creature is killed, sets SDF(3,5) to 1.)
//   Cell 3 - Dialogue node to start with if talked to. if left at 0, this
//     character doesn't talk.


begincreaturescript;

variables;

short i,target;

body;

beginstate INIT_STATE;
	set_mobility(ME,0);

break;

beginstate DEAD_STATE;
	// Set the appropriate stuff done flag for this character being dead
	if ((get_memory_cell(1) != 0) || (get_memory_cell(2) != 0))
		set_flag(get_memory_cell(1),get_memory_cell(2),1);
break;

beginstate START_STATE; 
	if (get_flag(10,1) == 2) {
		set_character_pose(ME,14);
		end_combat_turn();
		}


break;

beginstate TALKING_STATE;
	if (char_ok(7) == 1) {
		print_str("Talking: Stirlen interferes with your attempts to wake Miali.");
		end();
		}

	if(get_flag(2,16) == 2)
		begin_talk_mode(20);
	else
		begin_talk_mode(10);

//	run_town_script(34);

break;